/*
* @Author: Choisaaaa
* @Date: 2018/5/9  15:15
* 商品种类的业务
*/

var _mm = require("util/mm.js");

var _productCategory= {
    //1.获取商品种类列表
    getCategoryList : function(parentCategoryId,resolve, reject){
        _mm.request({
            url     : _mm.getServerUrl('/category/get_category.do'),
            data : {
                categoryId : parentCategoryId
            },
            method : "post",
            success : resolve,
            error   : reject
        });
    },
    //2.获取所有种类节点
    getAllCategoryList : function (resolve, reject) {
        _mm.request({
            url     : _mm.getServerUrl('/category/get_all_category.do'),
            method : "get",
            success : resolve,
            error   : reject
        });
    },
    //2.根据一级商品种类的ID找到该商品种类的下的所有商品种类
    getSecondlyCategoryList : function (firstCategoryId,resolve, reject) {
        _mm.request({
            url     : _mm.getServerUrl('/category/get_Secondly_category.do'),
            data : {
                parentCategoryId : firstCategoryId
            },
            method : "get",
            success : resolve,
            error   : reject
        });
    }
}

module.exports = _productCategory;